package chain_of_responsibility;

/**
 * @Author: linKe
 * @Date: 2022/1/14 22:55
 * @FileName: Client
 * @version: 1.0
 * @Description: 客户端测试
 */
public class Client {
    public static void main(String[] args) {
        FilterChain chain = new FilterChain();
        // 创建过滤器链对象，并添加过滤器
        // 根据添加顺序执行过滤器链中的过滤器
        chain.addFilter(new SensitiveFilter());
        chain.addFilter(new NameFilter());

        // 请求对象
        Request request = new Request();
        request.setRequestStr("敏感， linKe");
        // 响应对象
        Response response = new Response();
        response.setResponseStr("");

        chain.doFilter(request, response, chain);

        // 请求中被过滤后的字符串
        System.out.println(request.getRequestStr());
        // 响应中被过滤后的字符串
        System.out.println(response.getResponseStr());
    }

}
